#ifndef GITDAEMON_H
#define GITDAEMON_H

#include <QtCore/QObject>
#include <QtCore/QProcess>

class GitDaemon : public QObject
{
    Q_OBJECT

public:
    GitDaemon(QObject * parent = 0);

    bool isRunning() const;
    bool hasError() const;
    QString errorString() const;

    void setPort(int port);
    void setExportAll(bool exportall);
    void setUseDefaultPort(bool state);
    void setExecutable(const QString & exe);
    void setBasePath(const QString & path);

public slots:
    bool start();
    bool stop();

signals:
    void error(const QString & err);
    void message(const QString & msg);
    void started();
    void stopped();

private:
    void m_searchPid();
    void m_execute(const QString & cmd);

private:
    int m_pid;
    int m_port;
    bool m_exportAll;
    bool m_useDefaultPort;
    QString m_executable;
    QString m_basepath;
    QProcess::ProcessError m_error;
};

#endif // GITDAEMON_H
